#include "cardTypeManager.h"
#include "cardType.h"

cardTypeTab::cardTypeTab()
{
	this->initcardTypeList();
}

cardTypeTab::~cardTypeTab()
{

}

cardTypeTab* cardTypeTab::getInstance()
{
	static cardTypeTab* typeTab = nullptr;

	if (typeTab == nullptr)
	{
		typeTab = new cardTypeTab();
	}

	return typeTab;
}

bool isSpecial(const std::vector<PokerCard>& cardlist)
{
	std::vector<PokerCard> temp = cardlist;
	
	std::vector<cardType*> cardTypeList = cardTypeTab::getInstance()->getCardTypeList();

	for (std::vector<cardType*>::iterator it = cardTypeList.begin(); it < cardTypeList.end(); ++it)
	{
		if ((*it)->CheckType(temp))
		{
			return true;
		}
	}


	return false;
}

void cardTypeTab::initcardTypeList()
{
	cardTypeList.push_back(new ThirteenFlush(108));
	cardTypeList.push_back(new Thirteen(36));
	cardTypeList.push_back(new TwelveVeKing(24));
	cardTypeList.push_back(new ThreeStraightFlush(22));
	cardTypeList.push_back(new ThreeBoom(20));
	cardTypeList.push_back(new AllBig(15));
	cardTypeList.push_back(new AllSmall(12));
	cardTypeList.push_back(new SameColor(10));
	cardTypeList.push_back(new FourThreeSame(6));
	cardTypeList.push_back(new FivePairThree(5));
	cardTypeList.push_back(new SixPair(4));
	cardTypeList.push_back(new ThreeFlush(3));
	cardTypeList.push_back(new ThreeStraight(3));
	cardTypeList.push_back(new Single(1));
	cardTypeList.push_back(new OneDouble(1));
	cardTypeList.push_back(new FiveTwoDouble(1));
	cardTypeList.push_back(new Three(1));
	cardTypeList.push_back(new FiveFourOne(1));
	cardTypeList.push_back(new FiveMixedStrightNoA(1));
	cardTypeList.push_back(new FiveMixedStraightFirstA(1));
	cardTypeList.push_back(new FiveMixedStraightBackA(1));
	cardTypeList.push_back(new FiveFlush(1));
	cardTypeList.push_back(new FiveStraightFlushNoA(1));
	cardTypeList.push_back(new FiveStraightFlushFirstA(1));
	cardTypeList.push_back(new FiveStraightFlushBackA(1));
	cardTypeList.push_back(new FiveTwoDouble(1));
}

